<?php

namespace app\component\httpReferer;

/**
 * HttpReferer回跳组件
 * */
class HttpRefererComponent {
    private static $name = '_yzHttpReferer';

    /**
     * input表单html代码
     * */
    public static function getInputHtmls() {
        $httpReferer = $_SERVER['HTTP_REFERER'];
        if (is_null($httpReferer)) {
            return '';
        } else {
            return '<input type="hidden" name="' . self::$name .'" value="' . $httpReferer . '" />';
        }
    }

    /**
     * 获取回跳值
     * */
    public static function getValue() {
        return $_POST[self::$name];
    }
}